From 23b27a67a277769e0930e7f341229f9818251987 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Thu, 8 Feb 2001 22:14:31 +0000 Subject: [PATCH] (which-func-mode): Invert which-func-mode-global. Fix from Juanma Barranquero . --- lisp/which-func.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lisp/which-func.el b/lisp/which-func.el index b043753e688..5a70d5478c7 100644 --- a/lisp/which-func.el +++ b/lisp/which-func.el @@ -188,21 +188,21 @@ With prefix ARG, turn Which Function mode on iff arg is positive, and off otherwise." (interactive "P") (setq which-func-mode-global - (or (and (null arg) which-func-mode-global) - (<= (prefix-numeric-value arg) 0))) + (and (or arg (not which-func-mode-global)) + (> (prefix-numeric-value arg) 0))) (if which-func-mode-global - ;; Turn it off + ;;Turn it on (progn - (remove-hook 'post-command-idle-hook 'which-func-update) - (dolist (buf (buffer-list)) - (with-current-buffer buf (setq which-func-mode nil)))) - ;;Turn it on - (add-hook 'post-command-idle-hook 'which-func-update) + (add-hook 'post-command-idle-hook 'which-func-update) + (dolist (buf (buffer-list)) + (with-current-buffer buf + (setq which-func-mode + (or (eq which-func-modes t) + (member major-mode which-func-modes)))))) + ;; Turn it off + (remove-hook 'post-command-idle-hook 'which-func-update) (dolist (buf (buffer-list)) - (with-current-buffer buf - (setq which-func-mode - (or (eq which-func-modes t) - (member major-mode which-func-modes))))))) + (with-current-buffer buf (setq which-func-mode nil))))) (defun which-function () "Return current function name based on point. -- 2.30.2